<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/* jwsjs-2.2.1 (c) 2010-2018 Kenji Urushima | kjur.github.com/jsrsasign/license
<span class='line'>  2</span>  */</span><span class="WHIT">
<span class='line'>  3</span> </span><span class="COMM">/*
<span class='line'>  4</span>  * jwsjs.js - JSON Web Signature JSON Serialization (JWSJS) Class
<span class='line'>  5</span>  *
<span class='line'>  6</span>  * Copyright (c) 2010-2018 Kenji Urushima (kenji.urushima@gmail.com)
<span class='line'>  7</span>  *
<span class='line'>  8</span>  * This software is licensed under the terms of the MIT License.
<span class='line'>  9</span>  * https://kjur.github.io/jsrsasign/license/
<span class='line'> 10</span>  *
<span class='line'> 11</span>  * The above copyright and license notice shall be 
<span class='line'> 12</span>  * included in all copies or substantial portions of the Software.
<span class='line'> 13</span>  */</span><span class="WHIT">
<span class='line'> 14</span> 
<span class='line'> 15</span> </span><span class="COMM">/**
<span class='line'> 16</span>  * @fileOverview
<span class='line'> 17</span>  * @name jwsjs-2.0.js
<span class='line'> 18</span>  * @author Kenji Urushima kenji.urushima@gmail.com
<span class='line'> 19</span>  * @version jsrsasign 8.0.0 jwsjs 2.2.1 (2018-Mar-24)
<span class='line'> 20</span>  * @since jsjws 1.2, jsrsasign 4.8.0
<span class='line'> 21</span>  * @license &lt;a href="https://kjur.github.io/jsrsasign/license/">MIT License&lt;/a>
<span class='line'> 22</span>  */</span><span class="WHIT">
<span class='line'> 23</span> 
<span class='line'> 24</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">KJUR</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">KJUR</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">KJUR</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">KJUR.jws</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">KJUR.jws</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">KJUR.jws</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 26</span> 
<span class='line'> 27</span> </span><span class="COMM">/**
<span class='line'> 28</span>  * JSON Web Signature JSON Serialization (JWSJS) class.&lt;br/>
<span class='line'> 29</span>  * @class JSON Web Signature JSON Serialization (JWSJS) class
<span class='line'> 30</span>  * @name KJUR.jws.JWSJS
<span class='line'> 31</span>  * @property {array of String} aHeader array of Encoded JWS Headers
<span class='line'> 32</span>  * @property {String} sPayload Encoded JWS payload
<span class='line'> 33</span>  * @property {array of String} aSignature array of Encoded JWS signature value
<span class='line'> 34</span>  * @author Kenji Urushima
<span class='line'> 35</span>  * @version 2.1.0 (2016 Sep 6)
<span class='line'> 36</span>  * @see &lt;a href="https://kjur.github.io/jsjws/">old jwjws home page https://kjur.github.io/jsjws/&lt;/a>
<span class='line'> 37</span>  * @see &lt;a href="https://kjur.github.io/jsrsasigns/">'jwrsasign'(RSA Sign JavaScript Library) home page https://kjur.github.io/jsrsasign/&lt;/a>
<span class='line'> 38</span>  * @see &lt;a href="http://tools.ietf.org/html/draft-jones-json-web-signature-json-serialization-01">IETF I-D JSON Web Signature JSON Serialization (JWS-JS) specification&lt;/a>
<span class='line'> 39</span>  *
<span class='line'> 40</span>  * @description
<span class='line'> 41</span>  * This class generates and verfies "JSON Web Signature JSON Serialization (JWSJS)" of
<span class='line'> 42</span>  * &lt;a href="http://tools.ietf.org/html/draft-jones-json-web-signature-json-serialization-01">
<span class='line'> 43</span>  * IETF Internet Draft&lt;/a>. Here is major methods of this class:
<span class='line'> 44</span>  * &lt;ul>
<span class='line'> 45</span>  * &lt;li>{@link KJUR.jws.JWSJS#readJWSJS} - initialize with string or JSON object of JWSJS.&lt;/li>
<span class='line'> 46</span>  * &lt;li>{@link KJUR.jws.JWSJS#initWithJWS} - initialize with JWS as first signature.&lt;/li>
<span class='line'> 47</span>  * &lt;li>{@link KJUR.jws.JWSJS#addSignature} - append signature to JWSJS object.&lt;/li>
<span class='line'> 48</span>  * &lt;li>{@link KJUR.jws.JWSJS#verifyAll} - verify all signatures in JWSJS object.&lt;/li>
<span class='line'> 49</span>  * &lt;li>{@link KJUR.jws.JWSJS#getJSON} - get result of JWSJS object as JSON object.&lt;/li>
<span class='line'> 50</span>  * &lt;/ul>
<span class='line'> 51</span>  *
<span class='line'> 52</span>  * @example
<span class='line'> 53</span>  * // initialize
<span class='line'> 54</span>  * jwsjs1 = new KJUR.jws.JWSJS();
<span class='line'> 55</span>  * jwsjs1.readJWSJS("{headers: [...], payload: "eyJ...", signatures: [...]}");
<span class='line'> 56</span>  * 
<span class='line'> 57</span>  * // add PS256 signature with RSA private key object
<span class='line'> 58</span>  * prvKeyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...");
<span class='line'> 59</span>  * jwsjs1.addSignature("PS256", {alg: "PS256"}, prvKeyObj);
<span class='line'> 60</span>  * // add HS256 signature with HMAC password "secret"
<span class='line'> 61</span>  * jwsjs1.addSignature(null, {alg: "HS256"}, {utf8: "secret"});
<span class='line'> 62</span>  * 
<span class='line'> 63</span>  * // get result finally
<span class='line'> 64</span>  * jwsjsObj1 = jwsjs1.getJSON();
<span class='line'> 65</span>  *
<span class='line'> 66</span>  * // verify all signatures
<span class='line'> 67</span>  * isValid = jwsjs1.verifyAll([["-----BEGIN CERT...", ["RS256"]],
<span class='line'> 68</span>  *                             [{utf8: "secret"}, ["HS256"]]]); 
<span class='line'> 69</span>  * 
<span class='line'> 70</span>  */</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="NAME">KJUR.jws.JWSJS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_KJUR</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">	</span><span class="NAME">_KJUR_jws</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_KJUR.jws</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">	</span><span class="NAME">_KJUR_jws_JWS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_KJUR_jws.JWS</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">	</span><span class="NAME">_readSafeJSONString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_KJUR_jws_JWS.readSafeJSONString</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> 
<span class='line'> 77</span> </span><span class="WHIT">    </span><span class="NAME">this.aHeader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">    </span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">    </span><span class="NAME">this.aSignature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 80</span> 
<span class='line'> 81</span> </span><span class="WHIT">    </span><span class="COMM">// == initialize ==========================================================</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 83</span>      * (re-)initialize this object.&lt;br/>
<span class='line'> 84</span>      * @name init
<span class='line'> 85</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'> 86</span>      * @function
<span class='line'> 87</span>      */</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">    </span><span class="NAME">this.init</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">	</span><span class="NAME">this.aHeader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">	</span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">	</span><span class="NAME">this.aSignature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 93</span> 
<span class='line'> 94</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 95</span>      * (re-)initialize and set first signature with JWS.&lt;br/>
<span class='line'> 96</span>      * @name initWithJWS
<span class='line'> 97</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'> 98</span>      * @param {String} sJWS JWS signature to set
<span class='line'> 99</span>      * @function
<span class='line'>100</span>      * @example
<span class='line'>101</span>      * jwsjs1 = new KJUR.jws.JWSJWS();
<span class='line'>102</span>      * jwsjs1.initWithJWS("eyJ...");
<span class='line'>103</span>      */</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">    </span><span class="NAME">this.initWithJWS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sJWS</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">	</span><span class="NAME">this.init</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>106</span> 
<span class='line'>107</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sJWS.split</span><span class="PUNC">(</span><span class="STRN">"."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a.length</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"malformed input JWS"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>110</span> 
<span class='line'>111</span> </span><span class="WHIT">	</span><span class="NAME">this.aHeader.push</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">	</span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">	</span><span class="NAME">this.aSignature.push</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> 
<span class='line'>116</span> </span><span class="WHIT">    </span><span class="COMM">// == add signature =======================================================</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>118</span>      * add a signature to existing JWS-JS by algorithm, header and key.&lt;br/>
<span class='line'>119</span>      * @name addSignature
<span class='line'>120</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'>121</span>      * @function
<span class='line'>122</span>      * @param {String} alg JWS algorithm. If null, alg in header will be used.
<span class='line'>123</span>      * @param {Object} spHead string or object of JWS Header to add.
<span class='line'>124</span>      * @param {Object} key JWS key to sign. key object, PEM private key or HMAC key
<span class='line'>125</span>      * @param {String} pass optional password for encrypted PEM private key
<span class='line'>126</span>      * @throw if signature append failed.
<span class='line'>127</span>      * @example
<span class='line'>128</span>      * // initialize
<span class='line'>129</span>      * jwsjs1 = new KJUR.jws.JWSJS();
<span class='line'>130</span>      * jwsjs1.readJWSJS("{headers: [...], payload: "eyJ...", signatures: [...]}");
<span class='line'>131</span>      *
<span class='line'>132</span>      * // add PS256 signature with RSA private key object
<span class='line'>133</span>      * prvKeyObj = KEYUTIL.getKey("-----BEGIN PRIVATE KEY...");
<span class='line'>134</span>      * jwsjs1.addSignature("PS256", {alg: "PS256"}, prvKeyObj);
<span class='line'>135</span>      *
<span class='line'>136</span>      * // add HS256 signature with HMAC password "secret"
<span class='line'>137</span>      * jwsjs1.addSignature(null, {alg: "HS256"}, {utf8: "secret"});
<span class='line'>138</span>      *
<span class='line'>139</span>      * // get result finally
<span class='line'>140</span>      * jwsjsObj1 = jwsjs1.getJSON();
<span class='line'>141</span>      */</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">    </span><span class="NAME">this.addSignature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spHead</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"there's no JSON-JS signature to add."</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>145</span> 
<span class='line'>146</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sigLen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.aHeader.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.aHeader.length</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">this.aSignature.length</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"aHeader.length != aSignature.length"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>149</span> 
<span class='line'>150</span> </span><span class="WHIT">	</span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sJWS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">KJUR.jws.JWS.sign</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spHead</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.sPayload</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">pass</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sJWS.split</span><span class="PUNC">(</span><span class="STRN">"."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sHeader2</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sSignature2</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">	    </span><span class="NAME">this.aHeader.push</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">	    </span><span class="NAME">this.aSignature.push</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.aHeader.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">sigLen</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">this.aHeader.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.aSignature.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">sigLen</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">this.aSignature.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">	    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"addSignature failed: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>163</span> 
<span class='line'>164</span> </span><span class="WHIT">    </span><span class="COMM">// == verify signature ====================================================</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>166</span>      * verify all signature of JWS-JS object by array of key and acceptAlgs.&lt;br/>
<span class='line'>167</span>      * @name verifyAll
<span class='line'>168</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'>169</span>      * @function
<span class='line'>170</span>      * @param {array of key and acceptAlgs} aKeyAlg a array of key and acceptAlgs
<span class='line'>171</span>      * @return true if all signatures are valid otherwise false
<span class='line'>172</span>      * @since jwsjs 2.1.0 jsrsasign 5.1.0
<span class='line'>173</span>      * @example
<span class='line'>174</span>      * jwsjs1 = new KJUR.jws.JWSJS();
<span class='line'>175</span>      * jwsjs1.readJWSJS("{headers: [...], payload: "eyJ...", signatures: [...]}");
<span class='line'>176</span>      * isValid = jwsjs1.verifyAll([["-----BEGIN CERT...", ["RS256"]],
<span class='line'>177</span>      *                             [{utf8: "secret"}, ["HS256"]]]); 
<span class='line'>178</span>      */</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT">    </span><span class="NAME">this.verifyAll</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">aKeyAlg</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.aHeader.length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">aKeyAlg.length</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">	    </span><span class="NAME">this.aSignature.length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">aKeyAlg.length</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT">	    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>183</span> 
<span class='line'>184</span> </span><span class="WHIT">	</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">aKeyAlg.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>185</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keyAlg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">aKeyAlg</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">keyAlg.length</span><span class="WHIT">  </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.verifyNth</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keyAlg</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keyAlg</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>189</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>192</span> 
<span class='line'>193</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>194</span>      * verify Nth signature of JWS-JS object by key and acceptAlgs.&lt;br/>
<span class='line'>195</span>      * @name verifyNth
<span class='line'>196</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'>197</span>      * @function
<span class='line'>198</span>      * @param {Integer} idx nth index of JWS-JS signature to verify
<span class='line'>199</span>      * @param {Object} key key to verify
<span class='line'>200</span>      * @param {array of String} acceptAlgs array of acceptable signature algorithms
<span class='line'>201</span>      * @return true if signature is valid otherwise false
<span class='line'>202</span>      * @since jwsjs 2.1.0 jsrsasign 5.1.0
<span class='line'>203</span>      * @example
<span class='line'>204</span>      * jwsjs1 = new KJUR.jws.JWSJS();
<span class='line'>205</span>      * jwsjs1.readJWSJS("{headers: [...], payload: "eyJ...", signatures: [...]}");
<span class='line'>206</span>      * isValid1 = jwsjs1.verifyNth(0, "-----BEGIN CERT...", ["RS256"]);
<span class='line'>207</span>      * isValid2 = jwsjs1.verifyNth(1, {utf8: "secret"}, ["HS256"]);
<span class='line'>208</span>      */</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT">    </span><span class="NAME">this.verifyNth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">idx</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">acceptAlgs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.aHeader.length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NAME">idx</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.aSignature.length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NAME">idx</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT">	    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sHeader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.aHeader</span><span class="PUNC">[</span><span class="NAME">idx</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sSignature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.aSignature</span><span class="PUNC">[</span><span class="NAME">idx</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sJWS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sHeader</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"."</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">sSignature</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">	</span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT">	    </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_KJUR_jws_JWS.verify</span><span class="PUNC">(</span><span class="NAME">sJWS</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">acceptAlgs</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">	    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>223</span> 
<span class='line'>224</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>225</span>      * read JWS-JS string or object&lt;br/>
<span class='line'>226</span>      * @name readJWSJS
<span class='line'>227</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'>228</span>      * @function
<span class='line'>229</span>      * @param {Object} spJWSJS string or JSON object of JWS-JS to load.
<span class='line'>230</span>      * @throw if sJWSJS is malformed or not JSON string.
<span class='line'>231</span>      * @description
<span class='line'>232</span>      * NOTE: Loading from JSON object is suppored from 
<span class='line'>233</span>      * jsjws 2.1.0 jsrsasign 5.1.0 (2016-Sep-06).
<span class='line'>234</span>      * @example
<span class='line'>235</span>      * // load JWSJS from string
<span class='line'>236</span>      * jwsjs1 = new KJUR.jws.JWSJS();
<span class='line'>237</span>      * jwsjs1.readJWSJS("{headers: [...], payload: "eyJ...", signatures: [...]}");
<span class='line'>238</span>      *
<span class='line'>239</span>      * // load JWSJS from JSON object
<span class='line'>240</span>      * jwsjs1 = new KJUR.jws.JWSJS();
<span class='line'>241</span>      * jwsjs1.readJWSJS({headers: [...], payload: "eyJ...", signatures: [...]});
<span class='line'>242</span>      */</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT">    </span><span class="NAME">this.readJWSJS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spJWSJS</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">spJWSJS</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT">	    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oJWSJS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_readSafeJSONString</span><span class="PUNC">(</span><span class="NAME">spJWSJS</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT">	    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">oJWSJS</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"argument is not safe JSON object string"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>247</span> 
<span class='line'>248</span> </span><span class="WHIT">	    </span><span class="NAME">this.aHeader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oJWSJS.headers</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT">	    </span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oJWSJS.payload</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT">	    </span><span class="NAME">this.aSignature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oJWSJS.signatures</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT">	    </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">spJWSJS.headers.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT">		    </span><span class="NAME">this.aHeader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spJWSJS.headers</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>255</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"malformed header"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>258</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">spJWSJS.payload</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>259</span> </span><span class="WHIT">		    </span><span class="NAME">this.sPayload</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spJWSJS.payload</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"malformed signatures"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">spJWSJS.signatures.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">		    </span><span class="NAME">this.aSignatures</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spJWSJS.signatures</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">		    </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"malformed signatures"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>268</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT">		</span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"malformed JWS-JS JSON object: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ex</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>273</span> 
<span class='line'>274</span> </span><span class="WHIT">    </span><span class="COMM">// == utility =============================================================</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>276</span>      * get JSON object for this JWS-JS object.&lt;br/>
<span class='line'>277</span>      * @name getJSON
<span class='line'>278</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'>279</span>      * @function
<span class='line'>280</span>      * @example
<span class='line'>281</span>      * jwsj1 = new KJUR.jws.JWSJS();
<span class='line'>282</span>      * // do some jwsj1 operation then get result by getJSON()
<span class='line'>283</span>      * jwsjsObj1 = jwsjs1.getJSON();
<span class='line'>284</span>      * // jwsjsObj1 &rarr; { headers: [...], payload: "ey...", signatures: [...] }
<span class='line'>285</span>      */</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT">    </span><span class="NAME">this.getJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="STRN">"headers"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.aHeader</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT">		 </span><span class="STRN">"payload"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.sPayload</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT">		 </span><span class="STRN">"signatures"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.aSignature</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'>290</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>291</span> 
<span class='line'>292</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>293</span>      * check if this JWS-JS object is empty.&lt;br/>
<span class='line'>294</span>      * @name isEmpty
<span class='line'>295</span>      * @memberOf KJUR.jws.JWSJS#
<span class='line'>296</span>      * @function
<span class='line'>297</span>      * @return 1 if there is no signatures in this object, otherwise 0.
<span class='line'>298</span>      */</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT">    </span><span class="NAME">this.isEmpty</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.aHeader.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'>301</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>303</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>304</span> 
<span class='line'>305</span> </span></pre></body></html>